package site.guns.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import site.guns.couchdb.GunsDb;

@Controller
public class DetailsController {
    @Autowired
    private GunsDb gunsDb;

    @RequestMapping(value = "/details/{id}", method = RequestMethod.GET)
    public String get(@PathVariable String id, Model model) {
        model.addAttribute("gun", gunsDb.get(id));

        return "/details";
    }
}
